//  https://www.luogu.com.cn/problem/P10250

#include<iostream>
using namespace std;

int n;
const int N = 65;
long long f[N];
long long a, b, c;

int main()
{
    cin >> n;
    a = 1, b = 1, c = 2;
    for (int i = 3;i <= n;i++)
    {
        long long t = a + b + c;
        a = b;
        b = c;
        c = t;
    }
    if (n == 1) cout << b << endl;
    else cout << c << endl;

    return 0;
}